@use 'sass:color';
@use 'sass:map';
@use '@angular/material' as mat;

@mixin theme($theme) {
  $primary: map.get($theme, primary);
  $foreground: map.get($theme, foreground);
  $is-dark-theme: map.get($theme, is-dark);

  @if $is-dark-theme {
    :root {
      color-scheme: dark;
    }
  }

  a:not(.mat-mdc-button-base) {
    color: mat.get-color-from-palette($primary);

    &:hover {
      color: color.adjust(mat.get-color-from-palette($primary), $lightness: 10%);
    }
  }

  code {
    background-color: rgba(mat.get-color-from-palette($foreground, secondary-text), .03);
  }
}
